/*
 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Pins v3.0
processor: LPC54606J512
package_id: LPC54606J512BD100
mcu_data: ksdk2_0
processor_version: 2.0.2
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
 */

#include "fsl_common.h"
#include "fsl_inputmux.h"
#include "pin_mux.h"

/*FUNCTION**********************************************************************
 * 
 * Function Name : BOARD_InitBootPins
 * Description   : Calls initialization functions.
 * 
 *END**************************************************************************/
void BOARD_InitBootPins(void) {
    BOARD_InitPins();
}

#define PINTSEL0_IDX                     0u   /*!< Inputmux PINTSEL register index 0 */
#define PIO029_DIGIMODE_DIGITAL       0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO029_FILTEROFF_DISABLED     0x01u   /*!< Controls input glitch filter.: Filter disabled. No input filtering is done. */
#define PIO029_FUNC_ALT1              0x01u   /*!< Selects pin function.: Alternative connection 1. */
#define PIO029_INVERT_DISABLED        0x00u   /*!< Input polarity.: Disabled. Input function is not inverted. */
#define PIO029_OD_NORMAL              0x00u   /*!< Controls open-drain mode.: Normal. Normal push-pull output */
#define PIO029_SLEW_STANDARD          0x00u   /*!< Driver slew rate.: Standard mode, output slew rate control is enabled. More outputs can be switched simultaneously. */
#define PIO030_DIGIMODE_DIGITAL       0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO030_FILTEROFF_DISABLED     0x01u   /*!< Controls input glitch filter.: Filter disabled. No input filtering is done. */
#define PIO030_FUNC_ALT1              0x01u   /*!< Selects pin function.: Alternative connection 1. */
#define PIO030_INVERT_DISABLED        0x00u   /*!< Input polarity.: Disabled. Input function is not inverted. */
#define PIO030_OD_NORMAL              0x00u   /*!< Controls open-drain mode.: Normal. Normal push-pull output */
#define PIO030_SLEW_STANDARD          0x00u   /*!< Driver slew rate.: Standard mode, output slew rate control is enabled. More outputs can be switched simultaneously. */
#define PIO04_DIGIMODE_DIGITAL        0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO04_FUNC_ALT3               0x03u   /*!< Selects pin function.: Alternative connection 3. */
#define PIO06_DIGIMODE_DIGITAL        0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO06_FUNC_ALT0               0x00u   /*!< Selects pin function.: Alternative connection 0. */
#define PIO110_DIGIMODE_DIGITAL       0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO110_FUNC_ALT3              0x03u   /*!< Selects pin function.: Alternative connection 3. */
#define PIO112_DIGIMODE_DIGITAL       0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO112_FUNC_ALT3              0x03u   /*!< Selects pin function.: Alternative connection 3. */
#define PIO114_DIGIMODE_DIGITAL       0x01u   /*!< Select Analog/Digital mode.: Digital mode. */
#define PIO114_FUNC_ALT3              0x03u   /*!< Selects pin function.: Alternative connection 3. */

/*
 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'}
- pin_list:
  - {pin_num: '82', peripheral: FLEXCOMM0, signal: RXD_SDA_MOSI, pin_signal: PIO0_29/FC0_RXD_SDA_MOSI/CTIMER2_MAT3/SCT0_OUT8/TRACEDATA(2), invert: disabled, glitch_filter: disabled,
    slew_rate: standard, open_drain: disabled}
  - {pin_num: '95', peripheral: FLEXCOMM0, signal: TXD_SCL_MISO, pin_signal: PIO0_30/FC0_TXD_SCL_MISO/CTIMER0_MAT0/SCT0_OUT9/TRACEDATA(1), invert: disabled, glitch_filter: disabled,
    slew_rate: standard, open_drain: disabled}
  - {pin_num: '41', peripheral: CTIMER1, signal: 'MATCH, 0', pin_signal: PIO1_10/ENET_TXD1/FC1_RXD_SDA_MOSI/CTIMER1_MAT0/SCT0_OUT3/EMC_RASN}
  - {pin_num: '62', peripheral: CTIMER1, signal: 'MATCH, 1', pin_signal: PIO1_12/ENET_RXD0/FC6_SCK/CTIMER1_MAT1/USB0_PORTPWRN/EMC_DYCSN(0)}
  - {pin_num: '78', peripheral: CTIMER1, signal: 'MATCH, 2', pin_signal: PIO1_14/ENET_RX_DV/UTICK_CAP2/CTIMER1_MAT2/FC5_CTS_SDA_SSEL0/USB0_UP_LED/EMC_DQM(1)}
  - {pin_num: '87', peripheral: CTIMER3, signal: 'CAPTURE, 0', pin_signal: PIO0_4/CAN0_RD/FC4_SCK/CTIMER3_CAP0/SCT0_GPI4/EMC_D(2)/ENET_MDC}
  - {pin_num: '90', peripheral: PINT, signal: 'PINT, 0', pin_signal: PIO0_6/FC3_SCK/CTIMER3_CAP1/CTIMER4_MAT0/SCT0_GPI6/EMC_D(4)/ENET_RX_DV}
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
 */

/*FUNCTION**********************************************************************
 *
 * Function Name : BOARD_InitPins
 * Description   : Configures pin routing and optionally pin electrical features.
 *
 *END**************************************************************************/
void BOARD_InitPins(void) { /* Function assigned for the Core #0 (ARM Cortex-M4) */
  CLOCK_EnableClock(kCLOCK_InputMux);                        /* Enables the clock for the input muxes. 0 = Disable; 1 = Enable.: 0x01u */
  CLOCK_EnableClock(kCLOCK_Iocon);                           /* Enables the clock for the IOCON block. 0 = Disable; 1 = Enable.: 0x01u */

  INPUTMUX_AttachSignal(INPUTMUX,PINTSEL0_IDX,kINPUTMUX_GpioPort0Pin6ToPintsel); /* PIO0_6 is selected for PINT input 0 */
  IOCON->PIO[0][29] = ((IOCON->PIO[0][29] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_INVERT_MASK | IOCON_PIO_DIGIMODE_MASK | IOCON_PIO_FILTEROFF_MASK | IOCON_PIO_SLEW_MASK | IOCON_PIO_OD_MASK))) /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO029_FUNC_ALT1)                     /* Selects pin function.: PORT029 (pin 82) is configured as FC0_RXD_SDA_MOSI */
      | IOCON_PIO_INVERT(PIO029_INVERT_DISABLED)             /* Input polarity.: Disabled. Input function is not inverted. */
      | IOCON_PIO_DIGIMODE(PIO029_DIGIMODE_DIGITAL)          /* Select Analog/Digital mode.: Digital mode. */
      | IOCON_PIO_FILTEROFF(PIO029_FILTEROFF_DISABLED)       /* Controls input glitch filter.: Filter disabled. No input filtering is done. */
      | IOCON_PIO_SLEW(PIO029_SLEW_STANDARD)                 /* Driver slew rate.: Standard mode, output slew rate control is enabled. More outputs can be switched simultaneously. */
      | IOCON_PIO_OD(PIO029_OD_NORMAL)                       /* Controls open-drain mode.: Normal. Normal push-pull output */
    );
  IOCON->PIO[0][30] = ((IOCON->PIO[0][30] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_INVERT_MASK | IOCON_PIO_DIGIMODE_MASK | IOCON_PIO_FILTEROFF_MASK | IOCON_PIO_SLEW_MASK | IOCON_PIO_OD_MASK))) /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO030_FUNC_ALT1)                     /* Selects pin function.: PORT030 (pin 95) is configured as FC0_TXD_SCL_MISO */
      | IOCON_PIO_INVERT(PIO030_INVERT_DISABLED)             /* Input polarity.: Disabled. Input function is not inverted. */
      | IOCON_PIO_DIGIMODE(PIO030_DIGIMODE_DIGITAL)          /* Select Analog/Digital mode.: Digital mode. */
      | IOCON_PIO_FILTEROFF(PIO030_FILTEROFF_DISABLED)       /* Controls input glitch filter.: Filter disabled. No input filtering is done. */
      | IOCON_PIO_SLEW(PIO030_SLEW_STANDARD)                 /* Driver slew rate.: Standard mode, output slew rate control is enabled. More outputs can be switched simultaneously. */
      | IOCON_PIO_OD(PIO030_OD_NORMAL)                       /* Controls open-drain mode.: Normal. Normal push-pull output */
    );
  IOCON->PIO[0][4] = ((IOCON->PIO[0][4] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))      /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO04_FUNC_ALT3)                      /* Selects pin function.: PORT04 (pin 87) is configured as CTIMER3_CAP0 */
      | IOCON_PIO_DIGIMODE(PIO04_DIGIMODE_DIGITAL)           /* Select Analog/Digital mode.: Digital mode. */
    );
  IOCON->PIO[0][6] = ((IOCON->PIO[0][6] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))      /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO06_FUNC_ALT0)                      /* Selects pin function.: PORT06 (pin 90) is configured as PIO0_6 */
      | IOCON_PIO_DIGIMODE(PIO06_DIGIMODE_DIGITAL)           /* Select Analog/Digital mode.: Digital mode. */
    );
  IOCON->PIO[1][10] = ((IOCON->PIO[1][10] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))      /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO110_FUNC_ALT3)                     /* Selects pin function.: PORT110 (pin 41) is configured as CTIMER1_MAT0 */
      | IOCON_PIO_DIGIMODE(PIO110_DIGIMODE_DIGITAL)          /* Select Analog/Digital mode.: Digital mode. */
    );
  IOCON->PIO[1][12] = ((IOCON->PIO[1][12] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))      /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO112_FUNC_ALT3)                     /* Selects pin function.: PORT112 (pin 62) is configured as CTIMER1_MAT1 */
      | IOCON_PIO_DIGIMODE(PIO112_DIGIMODE_DIGITAL)          /* Select Analog/Digital mode.: Digital mode. */
    );
  IOCON->PIO[1][14] = ((IOCON->PIO[1][14] &
    (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))      /* Mask bits to zero which are setting */
      | IOCON_PIO_FUNC(PIO114_FUNC_ALT3)                     /* Selects pin function.: PORT114 (pin 78) is configured as CTIMER1_MAT2 */
      | IOCON_PIO_DIGIMODE(PIO114_DIGIMODE_DIGITAL)          /* Select Analog/Digital mode.: Digital mode. */
    );
}

/*******************************************************************************
 * EOF
 ******************************************************************************/
